package com.cy.service.impl;

import com.cy.dao.AccountDao;
import com.cy.entity.Account;
import com.cy.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.SQLException;
import java.util.List;

/**
 * @Author : 残影
 * @Date: 2020-09-14 09:48
 */
@Service("accountService")
public class AccountServiceImpl implements AccountService {
    @Autowired
    private AccountDao accountDao;

    @Override
    public void saveAccount(Account account) throws SQLException {
        accountDao.save(account);
    }

    @Override
    public void updateAccount(Account account) throws SQLException {
        accountDao.update(account);
    }

    @Override
    public void deleteAccount(Integer accountId) throws SQLException {
        accountDao.delete(accountId);
    }

    @Override
    public Account findAccountById(Integer accountId) throws SQLException {
        return accountDao.findById(accountId);
    }

    @Override
    public List<Account> findAllAccount() throws SQLException {
        return accountDao.findAll();
    }
}
